#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
#include "lineEq.glsl"
out vec4 FragColor;

in vec3 position;
uniform vec3 color;

float getLineX() { return getLineX(position.z); }

struct Ellipse {
	float centerZ;
	float hAxis;
	float vAxis;
};
uniform Ellipse ellipse;

void main()
{
	float centerZ = ellipse.centerZ;
	float hRadius = ellipse.hAxis / 2.0;
	float vRadius = ellipse.vAxis / 2.0;
	float deltaX = abs(position.x - getLineX()) / hRadius;
	float deltaZ = abs(position.z - centerZ) / vRadius;
	float fx = pow(deltaX, 0.3);
	float fz = smoothstep(0.0, 1.0, deltaZ);
	float alpha = (1.0 - fx) * (1.0 - fz);
	FragColor = vec4(color, alpha);
}
